package com.shrcl.engineerprocess.domain.impl;

import com.shrcl.engineerprocess.domain.EngineerLevel;
import com.shrcl.engineerprocess.domain.TSCFinalCost;
import com.shrcl.engineerprocess.domain.TSCManCostCalc;
import com.shrcl.engineerprocess.domain.impl.EngineerLevelImpl;
import com.shrcl.engineerprocess.domain.impl.TSCManCostCalcImpl;
import com.shrcl.engineerprocess.domain.proxy.TSCFinalCostProxy;
import edu.fudan.mylang.pf.BaseModelObject;
import edu.fudan.mylang.pf.IObjectFactory;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.hibernate.annotations.DiscriminatorOptions;

@Entity
@DiscriminatorValue("TSCFINALCOST_TYPE")
@DiscriminatorOptions(force = true)
@DiscriminatorColumn(length = 64)
@Table(name = "tscfinalcost")
public class TSCFinalCostImpl extends BaseModelObject implements TSCFinalCost {
  public TSCFinalCostImpl() {
    super();
  }
  
  public TSCFinalCostImpl(final TSCManCostCalc manCostCalc) {
    super();
    this.manCostCalc = manCostCalc;
  }
  
  @JoinColumn(name = "manCostCalc_id")
  @ManyToOne(targetEntity = TSCManCostCalcImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private TSCManCostCalc manCostCalc;
  
  public TSCManCostCalc getManCostCalc() {
    return this.manCostCalc;
  }
  
  public TSCFinalCost setManCostCalc(final TSCManCostCalc manCostCalc) {
    this.manCostCalc = manCostCalc;
    return this;			
    
  }
  
  @JoinColumn(name = "engineerLevel_id")
  @ManyToOne(targetEntity = EngineerLevelImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private EngineerLevel engineerLevel;
  
  public EngineerLevel getEngineerLevel() {
    return this.engineerLevel;
  }
  
  public TSCFinalCost setEngineerLevel(final EngineerLevel engineerLevel) {
    this.engineerLevel = engineerLevel;
    return this;			
    
  }
  
  private Integer man_day_year;
  
  public Integer getMan_day_year() {
    return this.man_day_year;
  }
  
  public TSCFinalCost setMan_day_year(final Integer man_day_year) {
    this.man_day_year = man_day_year;
    return this;			
    
  }
  
  private Double cost = Double.valueOf(0d);
  
  public Double getCost() {
    return this.cost;
  }
  
  public TSCFinalCost setCost(final Double cost) {
    this.cost = cost;
    return this;			
    
  }
  
  private Double dayCost = Double.valueOf(0d);
  
  public Double getDayCost() {
    return this.dayCost;
  }
  
  public TSCFinalCost setDayCost(final Double dayCost) {
    this.dayCost = dayCost;
    return this;			
    
  }
  
  public static TSCFinalCost create(final TSCManCostCalc manCostCalc, final IObjectFactory objectFactory) {
    com.shrcl.engineerprocess.domain.TSCFinalCost tSCFinalCost = new com.shrcl.engineerprocess.domain.impl.TSCFinalCostImpl(
    	manCostCalc
    );
    objectFactory.create(tSCFinalCost);
    return tSCFinalCost;			
    
  }
  
  public static TSCFinalCost createTSCFinalCostImpl(final TSCManCostCalc manCostCalc, final IObjectFactory objectFactory, final Procedure1<TSCFinalCost> init) {
    com.shrcl.engineerprocess.domain.TSCFinalCost tSCFinalCost = new com.shrcl.engineerprocess.domain.impl.TSCFinalCostImpl(
    	manCostCalc
    );
    objectFactory.create(tSCFinalCost);
    init.apply(tSCFinalCost);
    
    return tSCFinalCost;			
    
  }
  
  public TSCFinalCostProxy toProxy() {
    com.shrcl.engineerprocess.domain.proxy.TSCFinalCostProxy proxy = new com.shrcl.engineerprocess.domain.proxy.TSCFinalCostProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
